package com.bulk.demo.util;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 演示静态属性注入
 *
 * @author 散装java
 * @date 2023-04-13
 */
@Component
public class StaticAttribute {

    public static String NAME;

    @Value("${bulk.name}")
    public void setName(String name) {
        StaticAttribute.NAME = name;
    }

    @Scheduled(cron = "0/2 * * * * ? ")
    public void test() {
        System.out.println("name = " + NAME);
    }
}
